//
//  DYCommentsManageCell.m
//  kafuMerchant
//
//  Created by 帝云科技 on 2018/9/20.
//  Copyright © 2018年 帝云科技. All rights reserved.
//

#import "DYCommentsManageCell.h"

@interface DYCommentsManageCell ()

@property (nonatomic,strong)UILabel *cardNumLabel;
@property (nonatomic,strong)UILabel *timeLabel;
@property (nonatomic,strong)UILabel *commentsLabel;
@property (nonatomic,strong)UILabel *moneyLabel;
@property (nonatomic,strong)UIButton *replyButton;
@property (nonatomic,strong)UIView *replyView;
@property (nonatomic,strong)UILabel *replyLabel;

@end


@implementation DYCommentsManageCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}
-(void)dy_initUI
{
    [super dy_initUI];
    
     self.sideMargin=0;
    [self xhq_noneSelectionStyle];
    
    self.cardNumLabel = ({
        UILabel *label=[Utils labelWithTitle:@"会员卡号：" titleFontSize:12 textColor:[UIColor xhq_aTitle] backgroundColor:WhiteColor alignment:0];
        label;
    });
    
    self.timeLabel = ({
        UILabel *label=[Utils labelWithTitle:@"消费时间：" titleFontSize:12 textColor:[UIColor xhq_content] backgroundColor:WhiteColor alignment:2];
        label;
    });
    
    self.commentsLabel =({
        UILabel *label=[Utils labelWithTitleFontSize:12 textColor:[UIColor xhq_content] alignment:0];
        label.numberOfLines=0;
        label.lineBreakMode=NSLineBreakByTruncatingTail;
        label;
    });
    
    self.moneyLabel = ({
        UILabel *label=[Utils labelWithTitle:@"消费金额：" titleFontSize:14 textColor:[UIColor xhq_aTitle] backgroundColor:WhiteColor alignment:0];
        label;
    });
    
    self.replyButton = ({
        UIButton *button=[Utils createBtnWithType:UIButtonTypeCustom backgroundColor:WhiteColor action:@selector(replyButtonClick) target:self title:@"回复" image:nil font:13 textColor:[UIColor xhq_base]];
        [button xhq_cornerRadius:BILIHEIGHT(4)];
        [button xhq_borderColor:[UIColor xhq_base] borderWidth:BILIWIDTH(1)];
        button;
    });
    
    self.replyView =({
        UIView *view=[[UIView alloc]init];
        [view xhq_cornerRadius:5];
        view.backgroundColor=XHQHexColor(0xF7F7F7);
        view;
    });
    
    self.replyLabel = ({
        UILabel *label=[Utils labelWithTitleFontSize:12 textColor:[UIColor xhq_content] alignment:0];
        label;
    });
    
    [self addSubview:self.cardNumLabel];
    [self addSubview:self.timeLabel];
    [self addSubview:self.commentsLabel];
    [self addSubview:self.moneyLabel];
    [self addSubview:self.replyButton];
    [self addSubview:self.replyView];
    [self.replyView addSubview:self.replyLabel];
//
    [self.cardNumLabel makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(BILIHEIGHT(11));
        make.left.equalTo(BILIWIDTH(10));
        make.right.equalTo(self.timeLabel.left).offset(BILIWIDTH(-5));
    }];

    [self.timeLabel makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(BILIWIDTH(-10));
        make.centerY.equalTo(self.cardNumLabel);
    }];


    [self.commentsLabel makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.cardNumLabel.bottom).offset(BILIHEIGHT(10));
        make.left.equalTo(self.cardNumLabel);
        make.right.equalTo(self.timeLabel);
        make.bottom.equalTo(self.replyButton.top).offset(BILIHEIGHT(-10));
    }];

    [self.moneyLabel makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.cardNumLabel);
        make.width.equalTo(BILIWIDTH(200));
        make.bottom.equalTo(BILIHEIGHT(-15));
    }];

    [self.replyButton makeConstraints:^(MASConstraintMaker *make) {
        make.size.equalTo(CGSizeMake(BILIWIDTH(64), BILIHEIGHT(28)));
        make.right.equalTo(BILIWIDTH(-10));
        make.bottom.equalTo(BILIHEIGHT(-10));
    }];
    
    
    [self.replyView makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(BILIWIDTH(10));
        make.right.equalTo(BILIWIDTH(-10));
        make.top.equalTo(self.commentsLabel.bottom).offset(BILIHEIGHT(7));
    }];
    
    [self.replyLabel makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.replyView).offset(BILIWIDTH(12));
        make.right.equalTo(self.replyView).offset(BILIWIDTH(-12));
        make.top.equalTo(self.replyView).offset(BILIHEIGHT(12));
        make.bottom.equalTo(self.replyView).offset(BILIHEIGHT(-12));
        make.centerY.equalTo(self.replyView);
    }];
    
    self.commentsLabel.text=@"评价评价评价评价评价评价评价评价评价评价评价评价评价评价评价评价评价评价评价评价评价评价评价评价评价评价评价评价评价评价评价评价评价评价评价评价评价哈哈哈哈哈哈哈哈哈哈哈哈哈哈";
    [self.commentsLabel xhq_lineSpace:BILIHEIGHT(7)];
    self.commentsLabel.lineBreakMode=NSLineBreakByTruncatingTail;
    
//    self.replyButton.hidden=YES;
//    self.moneyLabel.hidden=YES;
    self.replyView.hidden=YES;
    
}
-(void)replyButtonClick
{
    !self.replyBlock?:self.replyBlock();
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
